home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1984 July / 1984-07.d64 / robot math_64 (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  4KB  |  124 lines

  1. 10 print"[147]":poke53281,1:poke53280,5:readp1$,p2,p3$,p4:goto710
  2. 12 readp1$,p2,p3$,p4:b=54272
  3. 15 fori=btob+24:pokei,0:next:vo=b+24:ad=b+5:sr=ad+1:hf=b+1:lf=b:pokead,20
  4. 16 pokesr,200:so=b+4:goto130
  5. 20 pokeso,32:return
  6. 30 pokehf,50:pokelf,40:pokeso,33:form=1toc:next:goto20
  7. 40 f=int(rnd(1)*9):return
  8. 50 pokeso,33:forl=99to255:pokehf,l:pokelf,50:next:gosub20:goto1050
  9. 60 pokeso,33:pokehf,60:pokelf,50:form=1to400:next:goto20
  10. 70 printm$;"        press return to change":return
  11. 80 printm$;"             enter digit[146]        ":return
  12. 90 iff>5thenl=126:iff>9thenl=108:m=1:iff>30thenl=90:m=0:iff>50thenl=108:m=1
  13. 100 iff>99thenf=0
  14. 110 pokee,l:pokee+1,l:goto430
  15. 120 print"":printtab(l);m$;o$;:pokevo,15:gosub30:pokevo,o:printn$:return
  16. 130 poke649,1:m$=" [206][163][163][205] [157][157][157][157][157][157] [205][218][218][206] [157][157][157][157][157][157] [187][204][186][172] [157][157][157][157][157][157] [169][171][179][223] [157][157][157][157][157][157]  [207][208]"
  17. 140 m$=m$+"  [157][157][157][157][157][157] [169]  [223][146] "
  18. 150 n$="[157][157][157][157][157][157] [215][215][215][215] ":o$="[157][157][157][157][157][157] [218][218][218][218] "
  19. 160 print"[147] m=menu-----------------------del=erase [146]"
  20. 165 poke214,23:print:poke211,15
  21. 170 l8=48:poke143,peek(162):goto1050
  22. 180 poke651,255:print"":r=54272:s=1561:y=p2:e=1106:rw=16:wr=rw-4:pokevo,15
  23. 190 ifp2=3thenrw=17:wr=rw-5
  24. 200 ifp1$="-"orp2=1orp2>3theny=2
  25. 210 poke214,rw:print:poke211,17:print"       "
  26. 220 fori=p2to1step-1:a(i)=0:s(i)=0:fork=1toy:gosub30:gosub40
  27. 230 a(i)=a(i)+f:s(i)=s(i)-f
  28. 240 m=(k*40)+i:poker+s+m,0:pokes+m,f+48:ifk=1thenl1=f
  29. 250 next:ifp1$="-"thengosub660:goto270
  30. 260 l=a(i):n=9:goto280
  31. 270 s(i)=s(i)+2*l1:l=s(i):n=0
  32. 280 gosub580:a(i)=l
  33. 290 nexti
  34. 300 fork=1toy:fori=1top2
  35. 310 m=k*40+i:ifpeek(s+m)>48then340
  36. 320 ifi=p2thenv=1
  37. 330 pokes+m,32:next
  38. 340 nextk:ifv=1thenv=0:goto180
  39. 350 a=0:u=-1:fori=p2to1step-1:u=u+1:ifp1$="-"thena=a+s(i)*10^u:goto370
  40. 360 a=a+a(i)*10^u
  41. 370 next
  42. 380 a=int(a):l2=0:ifa<0then180
  43. 390 fori=2toy:poke214,wr+i:print:poke211,17:print"[144]"p1$:next
  44. 400 poke160,0:poke161,0:poke162,0
  45. 410 fork=0top2:poke214,rw-1:print:poke211,17+k:print"[195]":next
  46. 420 u=len(str$(a))-2:i=0:l1=0:fork=p2top2-ustep-1
  47. 430 form=15to17:pokem+e+r+280,0:pokem+e+280,asc(mid$(ti$,m-11))+128:next
  48. 440 ifti$="000400"thengosub60:goto550
  49. 450 geta$:ifa$=""thenl=124:f=f+1:goto90
  50. 460 ifasc(a$)=20thenpoke214,rw:print:poke211,17:print"       ":goto420
  51. 470 ifa$="m"then710
  52. 480 ifa$<"0"ora$>"9"then440
  53. 490 print"":l1=int(l1+val(a$)*10^i):i=i+1
  54. 500 poke214,rw:print:poke211,17+k:printa$:next
  55. 510 ifl1=athengoto50
  56. 520 ifl1<>athengosub60
  57. 530 l2=l2+1:ifl2>2then550
  58. 540 goto410
  59. 550 v=0:an$=str$(a):l=len(an$):ifl>p2+1thenv=1
  60. 560 ifl-1<p2thenv=l-1-p2
  61. 570 poke214,rw:print:poke211,18-v:print"";mid$(an$,2,8):fork=1to3500:next:goto180
  62. 580 ifp3$="n"andp1$="+"then610
  63. 590 gosub40:x=1:ifl<n+fthen630
  64. 600 return
  65. 610 ifl>nthenx=-1:goto630
  66. 620 return
  67. 630 l=0:fork=1toy:m=(k*40)+i:f=peek(s+m)+x:iff<48thenf=48
  68. 640 iff>57thenf=57
  69. 650 pokes+m,f:l=l+(f-48):next:goto580
  70. 660 ifp3$="n"then690
  71. 670 ifi=1orf>=l1thenreturn
  72. 680 goto700
  73. 690 iff<l1thenreturn
  74. 700 pokes+m,l1+48:pokes+m-40,f+48:s(i)=(-f)-l1:l1=f:return
  75. 710 m$=""
  76. 720 print"[147][144]operation (+/-).... ";p1$
  77. 730 print"# digits (max=6)...";p2
  78. 740 print"carry/borrow....... ";p3$
  79. 750 print"# problems (max=9).";p4
  80. 760 print"    [197][197][197][197][197][197][197][197][197][197][197][197][197][197]
  81. 770 [141]70:[153]"     (b to begin)";
  82. 780 [153]"select:use crsr(up/dn)stop"
  83. 790 m[178]1152
  84. 800 [139]m1[178]1392[167]m[178]1152
  85. 810 [129]i[178]m[164]m[170]20:x[178][194](i):[151]i,x[170]128:[130]
  86. 820 [161]a$:[139]a$[178]""[167]820
  87. 830 [139][197](a$)[179]10[175][197](a$)[177]0[167]950
  88. 840 [139]a$[178]"+"[176]a$[178]"-"[176]a$[178]"y"[176]a$[178]"n"[176][194](197)[178]1[167]a$[178]"1":[137]950
  89. 850 [139]a$[178]""[167]900
  90. 860 [139]a$[178]"on"[167]940
  91. 870 [139]a$[179][177]"b"[167]820
  92. 880 [153]"load1040 data";p1$;",";p2;",";p3$;",";p4:[153]"run12";""
  93. 890 :[151]198,3:[151]631,13:[151]632,13:[151]633,13:[128]
  94. 900 m2[178]m2[171]1:k[178]80
  95. 910 m[178]m[170]k:[129]i[178]m[171]k[164]m[171]k[170]20:x[178][194](i):[151]i,x[171]128:[130]:[139]m[177]1392[167]m[178]1152
  96. 920 [139]m[179]1152[167]m[178]1392
  97. 930 [145](m[171]1064)[173]80[141]70,80,70,80:[137]800
  98. 940 m2[178]m2[171]1:k[178][171]80:[137]910
  99. 950 [145](m[171]1152)[173]80[137]980,1000,1030:[139]p1$[178]"+"[167]p1$[178]"-":[137]970
  100. 960 p1$[178]"+"
  101. 970 [151]m[170]20,[198](p1$)[170]128:[137]820
  102. 980 [139][197](a$)[177]6[167]a$[178]"6"
  103. 990 p2[178][197](a$):[151]m[170]20,p2[170]176:[137]820
  104. 1000 [139]p3$[178]"n"[167]p3$[178]"y":[137]1020
  105. 1010 p3$[178]"n"
  106. 1020 [151]m[170]20,64[170][198](p3$):[137]820
  107. 1030 p4[178][197](a$):[151]m[170]20,p4[170]176:[137]820
  108. 1040 [131]-, 2 ,n, 2
  109. 1050 c[178]0:[153]"stop":[129]l[178]0[164]34:[141]120:[130]
  110. 1060 [129]l[178]33[164]0[169][171]1:[141]120:[130]:[153]"":c[178]40
  111. 1070 [151]56334,[194](56334)[175]254:[151]1,[194](1)[175]251
  112. 1080 l8[178]l8[170]1:[139]l8[171]48[177]p4[167]1120
  113. 1090 m[178]53247[170]8[172]l8:[153]"";
  114. 1100 [129]m1[178]m[164]m[170]7:x[178][194](m1):[129]l[178]1[164]7:c[178]32:x[178]x[172]2:[139]x[177]255[167]x[178]x[171]256:c[178]209
  115. 1110 [153][163]30)"stop"[199](c);:[130]:[153]"cmdcmdcmdcmdcmdcmdcmd";:[130]
  116. 1120 [151]1,[194](1)[176]4:[151]56334,[194](56334)[176]1
  117. 1130 [139]l8[171]48[177]p4[167]1150
  118. 1140 [137]180
  119. 1150 [153]"load":[151]214,12:[153]:[151]211,4
  120. 1155 [153]"stophow about another game (y/n)?wait"
  121. 1160 [161]z$:[139]z$[178]""[176](z$[179][177]"y"[175]z$[179][177]"n")[167]1160
  122. 1170 [139]z$[178]"y"[167][140]:[156]:[137]10
  123. 1180 [128]
  124.